import Vue from "vue";
import VueRouter from "vue-router";
// 导入vuex本地存储
import store from "@/store/index";
import { Toast } from "vant";

//导入登录页面作为路由
import login from "@/views/login";
//导入找回密码组件
import retype from '@/views/login/components/retype.vue'
//导入一级路由layout
import Layout from "@/views/layout";
//导入home页面
import home from "@/views/home";
Vue.use(VueRouter);

const routes = [
  { path: "/", redirect: "/login" }, //设置路由重定项
  { name: "login", path: "/login", component: login }, //登录页面路由
  {name:'retype',path:'/retype',component:retype},  //找回密码作为路由
  //一级路由
  {
    name: "Layout",
    path: "/Layout",
    component: Layout,
    
    // 二级路由
    children: [
      {
        name: "home",
        path: "home",
        component: home,
        meta: {
          needLogin: true,
        },
      },
    ],
  },
];

const router = new VueRouter({
  routes,
});

// router.beforeEach((to,from,next)=>{

// })


export default router;
